<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=no">
    <link rel="stylesheet" href="/assets/css/bootstrap.min.css">
    <link rel="stylesheet" href="/assets/css/common.css">
    <link rel="stylesheet" href="/assets/css/css.css">
    <title>绑定用户编码</title>
</head>
<body>
    <section>
    		<h2>首次查看需要绑定用户编码</h2>
	    <div class="input-group">
		  <input id="userCode" type="number" class="form-control" placeholder="请绑定用户编码" aria-describedby="basic-addon2">
		  <span class="input-group-addon" id="basic-addon2">绑定</span>
		</div>
    </section>
    <script src="/assets/js/jquery-1.10.2.min.js"></script>
    <script src="/assets/js/jquery.mobile.custom.js"></script>
    <script src="/assets/js/bootstrap.min.js"></script>
    <script src="/assets/js/public.js"></script>
    {literal}
    <script type="text/javascript">
		$(function(){
			$("#basic-addon2").on('tap',function(){
				var userCode = $('#userCode').val();
				if(userCode == ''){
					alert("请输入用户编码");
					return;
				}
				var data = {userCode:userCode};
                $.ajax({
                    type:"patch",
                    url:"/api/manager/bind_user_code",
                    async:false,
                    dataType:"json",
                    data:data,
                    success:function(data){
                        if(data.success == true){
                            window.location.href=window.location.href + Math.random(); 
                        }else{
                            alert(data.errorMessage);
                        }
                    }
                });				
			});
		});
    </script>
    {/literal}
</body>
</html>